﻿using System;

namespace Validate.Net
{
    /// <summary>
    /// 校验Url格式
    /// </summary>
    public class ValidateUrlAttribute : ValidateRegularAttribute
    {
        private static string regularStr = @"^((https|http|ftp|rtsp|mms)?:\/\/)[^\s]+";

        public ValidateUrlAttribute() : base(regularStr)
        { }

        public override bool Validate(object value, out string msg)
        {
            if (base.Validate(value, out msg))
                return true;
            else
            {
                msg = "校验Url格式失败";
                return false;
            }
        }
    }
}
